version: '3.8'

services:
  shareit-server:
    build: server
    image: shareit-server-image
    container_name: shareit-server-container
    ports:
      - "9090:9090"
    depends_on:
      - shareit-db
    environment:
      - SPRING_DRIVER_CLASSNAME=org.postgresql.Driver
      - DB_HOST=shareit-db
      - DB_PORT=5432
      - DB_NAME=shareit
      - POSTGRES_USER=root
      - POSTGRES_PASSWORD=root

  shareit-gateway:
    build: gateway
    image: shareit-gateway-image
    container_name: shareit-gateway-container
    ports:
      - "8080:8080"
    depends_on:
      - shareit-server
    environment:
      - SERVER_URL=http://shareit-server:9090

  shareit-db:
    image: postgres:16.2-alpine
    container_name: shareit-db
    ports:
      - "6541:5432"
    environment:
      - POSTGRES_PASSWORD=root
      - POSTGRES_USER=root
      - POSTGRES_DB=shareit